From 8f49c0e970261f59bc043a8104a9a730ec69dcf4 Mon Sep 17 00:00:00 2001
From: Christian Ruppert <idl0r@gentoo.org>
Date: Wed, 23 Mar 2011 18:04:19 +0100
Subject: [PATCH] Use read() instead of sysread() when using mod_perl

https://rt.cpan.org/Public/Bug/Display.html?id=58538
---
 lib/SOAP/Transport/HTTP.pm |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/SOAP/Transport/HTTP.pm b/lib/SOAP/Transport/HTTP.pm
index f16b990..57ebbf3 100644
--- a/lib/SOAP/Transport/HTTP.pm
+++ b/lib/SOAP/Transport/HTTP.pm
@@ -566,9 +566,17 @@ sub handle {
         if ( !$chunked ) {
             my $buffer;
             binmode(STDIN);
-            while ( sysread( STDIN, $buffer, $length ) ) {
-                $content .= $buffer;
-                last if ( length($content) >= $length );
+            if ( defined($ENV{"MOD_PERL"}) ) {
+                while ( read( STDIN, $buffer, $length ) ) {
+                    $content .= $buffer;
+                    last if ( length($content) >= $length );
+                }
+            }
+            else {
+                while ( sysread( STDIN, $buffer, $length ) ) {
+                    $content .= $buffer;
+                    last if ( length($content) >= $length );
+                }
             }
         }
 
-- 
1.7.3.4

